package org.wzl.service.controller;

import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.wzl.service.dto.BlogCategorySaveDTO;
import org.wzl.service.service.BlogCategoryService;
import org.wzl.service.utils.Resp;
import org.wzl.service.vo.BlogCategoryVO;

import java.util.List;

/**
 * @author: 卫志龙
 * @date: 2024年06月30日 18:27
 */
@Slf4j
@RestController
@RequestMapping("/blog/category")
public class BlogCategoryController {

    @Resource
    private BlogCategoryService blogCategoryService;

    @PostMapping("/save")
    public Resp<?> save(@RequestBody BlogCategorySaveDTO blogCategorySaveDTO) {
        blogCategoryService.saveBlogCategory(blogCategorySaveDTO);
        return Resp.ok();
    }

    @GetMapping("/getAll")
    public Resp<List<BlogCategoryVO>> getAll() {
        return Resp.ok(blogCategoryService.getAll());
    }

}
